package com.server.entity;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;



/**
 * The persistent class for the Account database table.
 * 
 */
@Entity
@XmlRootElement
@Table(schema="mhp")
@NamedQueries({@NamedQuery(name="GetAccountByUser",query="select e from Account e where e.userId= :userId"),
@NamedQuery(name="GetAccountTypeByUser",query="select d from Account e Join e.accountType d where e.userId= :userId")})
public class Account implements Serializable {
	private static final long serialVersionUID = 1L;

	private String accountInfo;


	@Id
	private String accountId;
	
	@Column(name="UserId")
	private String userId;
	
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.LAZY)
	@JoinColumn(name="TypeId",insertable=false, updatable=false)
	private AccountType accountType;
	
	
	public Account() {
	}

	
	public Account(String accountId, String userId) {
		super();
		this.accountId = accountId;
		this.userId = userId;
	}


	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public void setAccountId(String accountId) {
		this.accountId = accountId;
	}
	
	
	public String getAccountId() {
		return accountId;
	}


	public String getAccountInfo() {
		return this.accountInfo;
	}

	public void setAccountInfo(String accountInfo) {
		this.accountInfo = accountInfo;
	}
	

	public AccountType getAccountType() {
		return accountType;
	}

	public void setAccountType(AccountType accountType) {
		this.accountType = accountType;
	}
}